// pages/persion/persion_message/persion_message.js

const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    avatarUrl:defaultAvatarUrl,
    nickName:'',
    openid:'',
  },

  goback: function() {
    wx.switchTab({
      url: '../persion',
    })
  },
  
  onShow: function(){
    const userProfile = wx.getStorageSync('userProfile');
    const openid = wx.getStorageSync('openid');
    if (userProfile && openid) {
      this.setData({
        avatarUrl: userProfile.avatarUrl,
        nickName: userProfile.nickname,
        openid: openid
      });
    } 
  }

  /**
   * 生命周期函数--监听页面加载
   */

})